<?php

function mreadFile($path = NULL) {
    $data = array();
    $file = fopen($path, "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
    while (!feof($file)) { 
        $data[] = fgets($file);
    }
    fclose($file);
    return $data;
}
function inputfile($contemts=array())
{
$fp= realpath("data/films.txt");
//var_dump($contemts);
//die();
$file = fopen($fp,'w') or exit("khong the mo file");  

foreach($contemts as $contemt)
{
    if($contemt=="")
       $a="";
    else
        $a=implode(";",$contemt);
fwrite($file,$a.PHP_EOL);
    
}
fclose($file); 
}